<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  /*李凤*/
  function myNew(fn, args) {
    let obj = {};
    let res = fn.call(obj, args);
    obj.__proto__ = Object.create(fn.prototype); // 实例.放
    if ((res !== null && typeof res === "object") || typeof res === "function") {
      return res;
    }

    return obj;
  }

  function P() {
    console.log(this);
    // return {a:123}
  }

  let a = myNew(P);

</script>
</body>
</html>
